package com.whw.fy.controller;

import com.whw.fy.entity.Jurisdiction;
import com.whw.fy.service.JurisdictionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import com.whw.fy.entity.Message;

import javax.annotation.Resource;

@Api(tags = "员工权限模块")
@RestController
@RequestMapping("/api/jurisdiction")
public class JurisdictionController {
    @Resource
    private JurisdictionService jurisdictionService;

    @ApiOperation(value = "添加权限(需要填写权限id)")
    @PostMapping("/one")
    public Message insert(Jurisdiction jurisdiction) {
        return jurisdictionService.insertSelective(jurisdiction);
    }



    @ApiOperation(value = "根据权限id查看权限")
    @GetMapping("/id")
    public Message selectById(Integer jurisdictionId) {
        return jurisdictionService.selectByPrimaryKey(jurisdictionId);
    }

    @ApiOperation(value = "查看所有权限")
    @GetMapping("/all")
    public Message selectALL() {
        return jurisdictionService.selectALL();
    }

    @ApiOperation(value = "修改权限")
    @PutMapping("/")
    public Message update(Jurisdiction jurisdiction) {
        return jurisdictionService.updateByPrimaryKeySelective(jurisdiction);
    }

    @ApiOperation(value = "根据id删除权限")
    @DeleteMapping("/id")
    public Message delete(Integer jurisdictionId) {
        return jurisdictionService.deleteByPrimaryKey(jurisdictionId);
    }
}
